package com.longma.server.constant.enums;

/**
 * 告警等级
 */

public enum AlarmLevelEnum  implements IBaseEnum<Integer> {
    //提示
    NOTIFY(0,"提示"),

    //次要
    SECONDARY(1,"次要"),

    //重要
    IMPORTANT(2,"重要"),

    //严重
    CRITICAL(3,"严重");

    /**
     * 值
     */
    private int value;

    /*
     * 描述信息
     */
    private String desc;

    /**
     * 构造函数
     */
    AlarmLevelEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 通过值转为枚举类型
     */
    public static AlarmLevelEnum fromValue(int value) {
        switch (value) {
            case 0:
                return NOTIFY;
            case 1:
                return SECONDARY;
            case 2:
                return IMPORTANT;
            case 3:
                return CRITICAL;
            default:
                throw new IllegalArgumentException();
        }
    }

    /**
     * 获取值
     */
    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getDesc() {
        return  this.desc;
    }

}
